bool isSameDay(DateTime date1, DateTime date2) {
  if (date1 == date2) {
    return true;
  }
  if (date1 == null) {
    return false;
  }
  if (date2 == null) {
    return false;
  }
  return date1.year == date2.year && date1.month == date2.month && date1.day == date2.day;
}

bool isDaySameOrBefore(DateTime day, DateTime baseline) {
  return isSameDay(day, baseline) || day.isBefore(baseline);
}

bool isDaySameOrAfter(DateTime day, DateTime baseline) {
  return isSameDay(day, baseline) || day.isAfter(baseline);
}